/*
 * Copyright (C) 2023 xuexiangjys(xuexiangjys@163.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.xuexiang.templateproject.widget;

import android.app.Dialog;
import android.content.Context;
import android.text.TextUtils;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.umeng.analytics.pro.d;
import com.xuexiang.templateproject.adapter.OptionAdapter;
import com.xuexiang.templateproject.adapter.OptionAnswerAdapter;
import com.xuexiang.templateproject.adapter.SetAnswerAdapter;
import com.xuexiang.templateproject.bean.Option;
import com.xuexiang.templateproject.bean.OptionsEntity;
import com.xuexiang.templateproject.utils.DimensionUtil;
import com.xuexiang.xui.utils.XToastUtils;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagFlowLayout;
//import d.m.b.l.b.e;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.Lazy;
//import kotlin.LazyKt__LazyJVMKt;
import kotlin.Metadata;
//import kotlin.collections.CollectionsKt__CollectionsKt;
//import kotlin.collections.CollectionsKt__IterablesKt;
//import kotlin.collections.CollectionsKt__MutableCollectionsKt;
//import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
//import org.jetbrains.anko.Sdk27ServicesKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import  com.xuexiang.templateproject.R;

// "adapter",
// "Lcom/jcds/learneasy/ui/adapter/SetAnswerAdapter;", "getAdapter",
// "()Lcom/jcds/learneasy/ui/adapter/SetAnswerAdapter;", "adapter$delegate",
// "Lkotlin/Lazy;", "answer", "", "currentType", "mOnSaveClickListener",
// "Lcom/jcds/learneasy/dialog/SetAnswerDialog$OnSaveClickListener;",
// "optionAdapter", "Lcom/jcds/learneasy/ui/adapter/OptionAdapter;",
// "getOptionAdapter", "()Lcom/jcds/learneasy/ui/adapter/OptionAdapter;",
// "optionAdapter$delegate", "optionAnswerAdapter", "Lcom/jcds/learneasy/ui/adapter/OptionAnswerAdapter;",
// "getOptionAnswerAdapter", "()Lcom/jcds/learneasy/ui/adapter/OptionAnswerAdapter;",
// "optionAnswerAdapter$delegate", "options", "Ljava/util/ArrayList;",
// "Lkotlin/collections/ArrayList;", "optionsStr", "problemId",
// "getProblemId", "()I", "setProblemId", "(I)V", "problemType",
// "selectAdapter", "getSelectAdapter", "selectAdapter$delegate",
// "selectType", "tempStart", "types", "changeState", "",
// "position", "getFooterView", "Landroid/view/View;",
// ServiceSpecificExtraArgs.CastExtraArgs.LISTENER,
// "Landroid/view/View$OnClickListener;", "initData",
// "initEvent", "initView", "sWidth", "setAnswerData",
// "optionsEntity", "", "Lcom/jcds/learneasy/entity/OptionsEntity;",
// "setOnSaveClickListener", "onSaveClickListener", "OnSaveClickListener",
// "app_huaweiRelease"}, k = 1, mv = {1, 7, 1}, xi = 48)

public final class SetAnswerDialog extends Dialog {

    /* renamed from: g  reason: collision with root package name */
    public final int TYPE_SINGLE = 0;

    /* renamed from: k  reason: collision with root package name */
    public int currentType;
    @Nullable

    /* renamed from: l  reason: collision with root package name */
    public a f3764l;
//    @NotNull
//
//    /* renamed from: m  reason: collision with root package name */
//    public final Lazy f3765m;
//    @NotNull
//
//    /* renamed from: n  reason: collision with root package name */
//    public final Lazy f3766n;
//    @NotNull
//
//    /* renamed from: o  reason: collision with root package name */
//    public final Lazy f3767o;
    @NotNull

    /* renamed from: a  reason: collision with root package name */
    public final ArrayList<String> mProblemTypeList //= CollectionsKt__CollectionsKt.arrayListOf("单选题", "多选题", "判断题", "其他题型");
     = new ArrayList<String>(Arrays.asList("单选题", "多选题", "判断题", "其他题型"));
    @NotNull

    /* renamed from: b  reason: collision with root package name */
    public final ArrayList<String> mTrueFalse //= CollectionsKt__CollectionsKt.arrayListOf("正确", "错误");
     = new ArrayList<String>(Arrays.asList("正确", "错误"));
    @NotNull

    /* renamed from: c  reason: collision with root package name */
    public ArrayList<Integer> f3755c //= CollectionsKt__CollectionsKt.arrayListOf(65, 66, 67, 68);
    = new ArrayList<Integer>(Arrays.asList(65, 66, 67, 68));
    /* renamed from: d  reason: collision with root package name */
    public int f3756d = 68;
    @NotNull

    /* renamed from: e  reason: collision with root package name */
    public String mProblemType = "";
    @NotNull

    /* renamed from: f  reason: collision with root package name */
    public String mOptions = "";

    /* renamed from: h  reason: collision with root package name */
    public final int TYPE_MUTI = 1;

    /* renamed from: i  reason: collision with root package name */
    public final int TYPE_TRUEFALSE = 2;

    /* renamed from: j  reason: collision with root package name */
    public final int TYPE_OTHER = 3;

    private Context mContext;
//    @NotNull

    /* renamed from: p  reason: collision with root package name */
//    public final Lazy f3768p = LazyKt__LazyJVMKt.lazy(SetAnswerDialog$optionAdapter$2.f3772a);

    public interface a {
        void a(@NotNull Map<String, String> map);

        void onDismiss();
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public SetAnswerDialog(@NotNull Context context) {
        super(context, R.style.CustomDialog);
        mContext = context;
        Intrinsics.checkNotNullParameter(context, "context");
//        this.f3765m = LazyKt__LazyJVMKt.lazy(new SetAnswerDialog$adapter$2(this, context));
//        this.f3766n = LazyKt__LazyJVMKt.lazy(new SetAnswerDialog$optionAnswerAdapter$2(this, context));
//        this.f3767o = LazyKt__LazyJVMKt.lazy(new SetAnswerDialog$selectAdapter$2(this, context));

        setContentView(R.layout.layout_set_answer);
        setCancelable(false);
        setCanceledOnTouchOutside(false);
        Window window = getWindow();
        WindowManager.LayoutParams attributes = window != null ? window.getAttributes() : null;
        if (attributes != null) {
            attributes.gravity = 80;
        }
        Display defaultDisplay = getOwnerActivity().getWindowManager().getDefaultDisplay();//Sd
        int width = defaultDisplay.getWidth();
        if (attributes != null) {
            attributes.width = width;
        }
        Window window2 = getWindow();
        if (window2 != null) {
            window2.setAttributes(attributes);
        }
        initEvent();
        o(width);
        j();
    }

    public static final boolean setToTag(SetAnswerDialog dialog, View view, int i2, FlowLayout flowLayout) {
//        Intrinsics.checkNotNullParameter(this$0, "this$0");
        if (dialog.currentType == i2) {
            return true;
        }
        dialog.currentType = i2;
        String str = dialog.mProblemTypeList.get(i2);
//        Intrinsics.checkNotNullExpressionValue(str, "types[position]");
        dialog.mProblemType = str;
        dialog.changeState(i2);
        return true;
    }

    public static final void close(SetAnswerDialog this$0, View view) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        a aVar = this$0.f3764l;
        if (!(aVar == null || aVar == null)) {
            aVar.onDismiss();
        }
        this$0.dismiss();
    }

    public static final void save(SetAnswerDialog this$0, View view) {
//        Intrinsics.checkNotNullParameter(this$0, "this$0");
        int i2 = this$0.currentType;
        String str = "";
        if (i2 == this$0.TYPE_SINGLE || i2 == this$0.TYPE_MUTI) {
            Set<Integer> selectedList = ((TagFlowLayout) this$0.findViewById(R.id.tgAnswer)).getSelectedList();
            ArrayList arrayList = new ArrayList();
            for (Integer item : selectedList) {
                ArrayList<Integer> arrayList2 = this$0.f3755c;
                Intrinsics.checkNotNullExpressionValue(item, "item");
                arrayList.add(arrayList2.get(item.intValue()));
            }
            if (!arrayList.isEmpty()) {
//                str = CollectionsKt___CollectionsKt.joinToString$default(arrayList, ",", null, null, 0, null, SetAnswerDialog$initEvent$3$1.f3771a, 30, null);
                str = String.join(",",arrayList);
            }
            if (TextUtils.isEmpty(this$0.mOptions) || TextUtils.isEmpty(str)) {
                Context context = this$0.getContext();
//                Intrinsics.checkNotNullExpressionValue(context, "context");
//                ExtensionsKt.showToast(context, "选项或者答案不能为空");
                XToastUtils.info("选项或者答案不能为空");
                return;
            }
            HashMap hashMap = new HashMap();
            hashMap.put("problemType", this$0.mProblemType);
            hashMap.put("options", this$0.mOptions);
            hashMap.put("answer", str);
            a aVar = this$0.f3764l;
            if (!(aVar == null || aVar == null)) {
                aVar.a(hashMap);
            }
        } else if (i2 == this$0.TYPE_TRUEFALSE) {
            Set<Integer> selectedList2 = ((TagFlowLayout) this$0.findViewById(R.id.tgAnswer)).getSelectedList();
            ArrayList arrayList3 = new ArrayList();
            for (Integer item2 : selectedList2) {
                ArrayList<String> arrayList4 = this$0.mTrueFalse;
//                Intrinsics.checkNotNullExpressionValue(item2, "item");
                arrayList3.add(arrayList4.get(item2.intValue()));
            }
            if (!arrayList3.isEmpty()) {
//                str = CollectionsKt___CollectionsKt.joinToString$default(arrayList3, ",", null, null, 0, null, null, 62, null);
                str = String.join(",",arrayList3);
            }
            if (TextUtils.isEmpty(str)) {
                Context context2 = this$0.getContext();
                Intrinsics.checkNotNullExpressionValue(context2, "context");
//                ExtensionsKt.showToast(context2, "答案不能为空");
                XToastUtils.info("答案不能为空");
                return;
            }
            HashMap hashMap2 = new HashMap();
            hashMap2.put("problemType", this$0.mProblemType);
            hashMap2.put("answer", str);
            a aVar2 = this$0.f3764l;
            if (!(aVar2 == null || aVar2 == null)) {
                aVar2.a(hashMap2);
            }
        } else {
            HashMap hashMap3 = new HashMap();
            hashMap3.put("problemType", this$0.mProblemType);
            a aVar3 = this$0.f3764l;
            if (!(aVar3 == null || aVar3 == null)) {
                aVar3.a(hashMap3);
            }
        }
    }

    public static final void p(SetAnswerDialog this$0, View view) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");

        int i2 = this$0.f3756d + 1;
        this$0.f3756d = i2;
        this$0.getOptionAdapter().addData(Integer.valueOf(i2));
        this$0.f3755c.add(Integer.valueOf(this$0.f3756d));
        ArrayList<Integer> arrayList = this$0.f3755c;
        ArrayList arrayList2 = new ArrayList();
        for (Number number : arrayList) {
            arrayList2.add(String.valueOf((char) number.intValue()));
        }
//        this$0.mOptions = CollectionsKt___CollectionsKt.joinToString$default(arrayList2, ",", null, null, 0, null, null, 62, null);
        this$0.mOptions = String.join(",",arrayList2);
        if (this$0.currentType == this$0.TYPE_SINGLE) {
            ((TagFlowLayout) this$0.findViewById(R.id.tgAnswer)).setMaxSelectCount(1);
        } else {
            ((TagFlowLayout) this$0.findViewById(R.id.tgAnswer)).setMaxSelectCount(this$0.f3755c.size());
        }
        this$0.getOptionAnswerAdapter().notifyDataChanged();
    }

    public static final void q(SetAnswerDialog this$0, BaseQuickAdapter baseQuickAdapter, View view, int i2) {
        this$0.getOptionAdapter().remove(this$0.f3755c.size() - 1);
//        CollectionsKt__MutableCollectionsKt.removeLast(this$0.f3755c);
        this$0.f3755c.remove(this$0.f3755c.get(this$0.f3755c.size()-1));
        ArrayList<Integer> arrayList = this$0.f3755c;
        ArrayList arrayList2 = new ArrayList();
        for (Number number : arrayList) {
            arrayList2.add(String.valueOf((char) number.intValue()));
        }
//        this$0.mOptions = CollectionsKt___CollectionsKt.joinToString$default(arrayList2, ",", null, null, 0, null, null, 62, null);
        this$0.mOptions = String.join(",",arrayList2);
        this$0.f3756d--;
        if (this$0.currentType == this$0.TYPE_SINGLE) {
            ((TagFlowLayout) this$0.findViewById(R.id.tgAnswer)).setMaxSelectCount(1);
        } else {
            ((TagFlowLayout) this$0.findViewById(R.id.tgAnswer)).setMaxSelectCount(this$0.f3755c.size());
        }
        this$0.getOptionAnswerAdapter().notifyDataChanged();
    }

    public final void changeState(int i2) {
        this.currentType = i2;
        String str = this.mProblemTypeList.get(i2);
        Intrinsics.checkNotNullExpressionValue(str, "types[position]");
        this.mProblemType = str;
        getOptionAnswerAdapter().setSelectedList(new HashSet());
        if (i2 == this.TYPE_SINGLE) {
            ((LinearLayout) findViewById(R.id.llOption)).setVisibility(View.VISIBLE);
            ((LinearLayout) findViewById(R.id.llAnswer)).setVisibility(View.VISIBLE);
            ((TextView) findViewById(R.id.tvTips)).setVisibility(View.GONE);
            ((TagFlowLayout) findViewById(R.id.tgAnswer)).setAdapter(getOptionAnswerAdapter());
            ((TagFlowLayout) findViewById(R.id.tgAnswer)).setMaxSelectCount(1);
        } else if (i2 == this.TYPE_MUTI) {
            ((LinearLayout) findViewById(R.id.llOption)).setVisibility(View.VISIBLE);
            ((LinearLayout) findViewById(R.id.llAnswer)).setVisibility(View.VISIBLE);
            ((TextView) findViewById(R.id.tvTips)).setVisibility(View.GONE);
            ((TagFlowLayout) findViewById(R.id.tgAnswer)).setAdapter(getOptionAnswerAdapter());
            ((TagFlowLayout) findViewById(R.id.tgAnswer)).setMaxSelectCount(this.f3755c.size());
        } else if (i2 == this.TYPE_TRUEFALSE) {
            ((LinearLayout) findViewById(R.id.llOption)).setVisibility(View.GONE);
            ((LinearLayout) findViewById(R.id.llAnswer)).setVisibility(View.VISIBLE);
            ((TextView) findViewById(R.id.tvTips)).setVisibility(View.GONE);
            ((TagFlowLayout) findViewById(R.id.tgAnswer)).setAdapter(getTagAnswerAdapter());
            ((TagFlowLayout) findViewById(R.id.tgAnswer)).setMaxSelectCount(1);
        } else if (i2 == this.TYPE_OTHER) {
            ((LinearLayout) findViewById(R.id.llOption)).setVisibility(View.GONE);
            ((LinearLayout) findViewById(R.id.llAnswer)).setVisibility(View.GONE);
            ((TextView) findViewById(R.id.tvTips)).setVisibility(View.VISIBLE);
        }
    }



    public final View getFootView(View.OnClickListener onClickListener) {
        View inflate = getLayoutInflater().inflate(R.layout.footview_match_option, (ViewGroup) ((RecyclerView) findViewById(R.id.rcyOption)), false);
//        Intrinsics.checkNotNullExpressionValue(inflate, "layoutInflater.inflate(R…option, rcyOption, false)");
        inflate.setOnClickListener(onClickListener);
        return inflate;
    }
    private OptionAdapter mOptionAdapter;
    public final OptionAdapter getOptionAdapter() {
        if(mOptionAdapter==null){
            mOptionAdapter = new OptionAdapter(R.layout.item_match_option);
        }
        return mOptionAdapter;
    }
    private OptionAnswerAdapter mOptionAnswerAdapter;
    public final OptionAnswerAdapter getOptionAnswerAdapter() {
        if(mOptionAnswerAdapter==null){
            mOptionAnswerAdapter = new OptionAnswerAdapter(f3755c, mContext, R.layout.item_text_view, 70.0f, 40.0f, R.drawable.bg_white_corner);
        }
        return mOptionAnswerAdapter;
    }
    private SetAnswerAdapter mTagAnswerAdapter;
    public final SetAnswerAdapter getTagAnswerAdapter() {
        if(mTagAnswerAdapter==null){
            mTagAnswerAdapter = new SetAnswerAdapter(mTrueFalse, mContext, R.layout.item_text_view, 50.0f, 40.0f, R.drawable.bg_white_corner);
        }
        return mTagAnswerAdapter;
//        return (SetAnswerAdapter) this.f3767o.getValue();
    }
    private SetAnswerAdapter mQuestionStyle;
    public final SetAnswerAdapter getQuestionStyleAdapter() {
        if(mQuestionStyle==null){
            mQuestionStyle = new SetAnswerAdapter(mProblemTypeList, mContext, R.layout.item_text_view, 70.0f, 40.0f, R.drawable.bg_white_corner);
        }
        return mQuestionStyle;
    }
    public final void j() {
        ((TagFlowLayout) findViewById(R.id.tgAnswer)).setAdapter(getOptionAnswerAdapter());
        ((TagFlowLayout) findViewById(R.id.questionStyle)).setAdapter(getQuestionStyleAdapter());
        getQuestionStyleAdapter().setSelectedList(0);
        getOptionAdapter().setList(this.f3755c);
    }

    public final void initEvent() {
        ((TagFlowLayout) findViewById(R.id.questionStyle)).setOnTagClickListener(new TagFlowLayout.OnTagClickListener() {
            @Override
            public boolean onTagClick(View view, int position, FlowLayout parent) {
                return SetAnswerDialog.setToTag(SetAnswerDialog.this, view, position, parent);
            }

        });
        ImageView ivClose = (ImageView) findViewById(R.id.ivClose);
//        Intrinsics.checkNotNullExpressionValue(ivClose, "ivClose");
        ivClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SetAnswerDialog.close(SetAnswerDialog.this, view);
            }
        });

        TextView tvSave = (TextView) findViewById(R.id.tvSave);

        tvSave.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SetAnswerDialog.save(SetAnswerDialog.this, view);
            }
        });

    }

    public final void o(int i2) {
        this.currentType = this.TYPE_SINGLE;
        String str = this.mProblemTypeList.get(0);
//        Intrinsics.checkNotNullExpressionValue(str, "types[0]");
        this.mProblemType = str;
        ArrayList<Integer> arrayList = this.f3755c;
        ArrayList arrayList2 = new ArrayList();
        for (Number number : arrayList) {
            arrayList2.add(String.valueOf((char) number.intValue()));
        }
//        this.mOptions = CollectionsKt___CollectionsKt.joinToString$default(arrayList2, ",", null, null, 0, null, null, 62, null);
        this.mOptions = String.join(",",arrayList2);
        DimensionUtil eVar = DimensionUtil.f14611a;
        GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), (i2 - (eVar.getPx(15) * 2)) / eVar.getPx(60));
        ((RecyclerView) findViewById(R.id.rcyOption)).setAdapter(getOptionAdapter());
        ((RecyclerView) findViewById(R.id.rcyOption)).setLayoutManager(gridLayoutManager);
        getOptionAdapter().addFooterView(getFootView(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SetAnswerDialog.p(SetAnswerDialog.this, view);
            }
        }));
//        BaseQuickAdapter.h(getOptionAdapter(), f(new View.OnClickListener() { // from class: d.m.b.g.b0
//            @Override // android.view.View.OnClickListener
//            public final void onClick(View view) {
//                SetAnswerDialog.p(SetAnswerDialog.this, view);
//            }
//        }), 0, 0, 4, null);

        getOptionAdapter().setOnItemClickListener(new OnItemClickListener() { // from class: d.m.b.g.e0
            @Override // d.f.a.a.a.f.d
            public final void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int position) {
                SetAnswerDialog.q(SetAnswerDialog.this, baseQuickAdapter, view, position);
            }
        });
    }

    public final void setOnSaveClickListener(@NotNull a onSaveClickListener) {
        Intrinsics.checkNotNullParameter(onSaveClickListener, "onSaveClickListener");
        this.f3764l = onSaveClickListener;
    }

    public final void w(@NotNull List<OptionsEntity> optionsEntity) {
        Intrinsics.checkNotNullParameter(optionsEntity, "optionsEntity");
        ArrayList arrayList = new ArrayList();
        for (Object obj : optionsEntity) {
            if (((OptionsEntity) obj).getChecked()) {
                arrayList.add(obj);
            }
        }
        OptionsEntity optionsEntity2 = (OptionsEntity) arrayList.get(0);
        String problemType = optionsEntity2.getProblemType();
        this.mProblemType = problemType;
        int indexOf = this.mProblemTypeList.indexOf(problemType);
        this.currentType = indexOf;
        getQuestionStyleAdapter().setSelectedList(indexOf);
        if (indexOf == this.TYPE_SINGLE || indexOf == this.TYPE_MUTI) {
            ((LinearLayout) findViewById(R.id.llOption)).setVisibility(View.VISIBLE);
            ((LinearLayout) findViewById(R.id.llAnswer)).setVisibility(View.VISIBLE);
            ((TextView) findViewById(R.id.tvTips)).setVisibility(View.GONE);
            ((TagFlowLayout) findViewById(R.id.tgAnswer)).setAdapter(getOptionAnswerAdapter());
            List<Option> options = optionsEntity.get(0).getOptions();
            ArrayList arrayList2 =  new ArrayList<>();
            for (Option option : options) {
                char[] charArray = option.getName().toCharArray();
                Intrinsics.checkNotNullExpressionValue(charArray, "this as java.lang.String).toCharArray()");
                arrayList2.add(Integer.valueOf(charArray[0]));
            }
            getOptionAdapter().setList(arrayList2);
            this.f3755c.clear();
            this.f3755c.addAll(arrayList2);
//            this.f3756d = ((Number) CollectionsKt___CollectionsKt.last((List<? extends Object>) arrayList2)).intValue();
            this.f3756d = ((Number) arrayList2.get(arrayList2.size()-1)).intValue();
            if (indexOf == this.TYPE_SINGLE) {
                ((TagFlowLayout) findViewById(R.id.tgAnswer)).setMaxSelectCount(1);
            } else {
                ((TagFlowLayout) findViewById(R.id.tgAnswer)).setMaxSelectCount(this.f3755c.size());
            }
            getOptionAnswerAdapter().notifyDataChanged();
            List<Option> answer = optionsEntity2.getAnswer();
            ArrayList<Option> arrayList3 = new ArrayList();
            for (Option obj2 : answer) {
                if (((Option) obj2).getChecked()) {
                    arrayList3.add(obj2);
                }
            }
            ArrayList arrayList4 = new ArrayList<>();
            for (Option option2 : arrayList3) {
                arrayList4.add(option2.getName());
            }
            HashSet hashSet = new HashSet();
            List<Option> answer2 = optionsEntity2.getAnswer();
            ArrayList<String> arrayList5 = new ArrayList<>();
            for (Option option3 : answer2) {
                arrayList5.add(option3.getName());
            }
            int size = arrayList4.size();
            for (int i2 = 0; i2 < size; i2++) {
                hashSet.add(Integer.valueOf(arrayList5.indexOf(arrayList4.get(i2))));
            }
            getOptionAnswerAdapter().setSelectedList(hashSet);
        } else if (indexOf == this.TYPE_TRUEFALSE) {
            ((LinearLayout) findViewById(R.id.llOption)).setVisibility(View.GONE);
            ((LinearLayout) findViewById(R.id.llAnswer)).setVisibility(View.VISIBLE);
            ((TextView) findViewById(R.id.tvTips)).setVisibility(View.GONE);

            ((TagFlowLayout) findViewById(R.id.tgAnswer)).setAdapter(getTagAnswerAdapter());
            ((TagFlowLayout) findViewById(R.id.tgAnswer)).setMaxSelectCount(1);
            List<Option> answer3 = optionsEntity2.getAnswer();
            ArrayList arrayList6 = new ArrayList();
            for (Object obj3 : answer3) {
                if (((Option) obj3).getChecked()) {
                    arrayList6.add(obj3);
                }
            }
            getTagAnswerAdapter().setSelectedList(this.mTrueFalse.indexOf(((Option) arrayList6.get(0)).getName()));
        } else {
            ((LinearLayout) findViewById(R.id.llOption)).setVisibility(View.GONE);
            ((LinearLayout) findViewById(R.id.llAnswer)).setVisibility(View.GONE);
            ((TextView) findViewById(R.id.tvTips)).setVisibility(View.VISIBLE);
        }
    }
}